package edu.njust.cma.DTO;

import edu.njust.cma.pojo.Submission;
import edu.njust.cma.pojo.User;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class SubTaskForLab {
    private int projectId;
    private int taskId;
    private String projectName;
    private String standardName;
    private String methodName;
    private User labUser;
    private int type;
    private String createTime;
    private int status;
    private Submission submission;

    private Integer subtaskId;

    // 实现一个构造函数
    public SubTaskForLab(int projectId, int taskId, String projectName, String standardName, String methodName,
                         User labUser, int type, String createTime, int status, Submission submission) {
        this.projectId = projectId;
        this.taskId = taskId;
        this.projectName = projectName;
        this.standardName = standardName;
        this.methodName = methodName;
        this.labUser = labUser;
        this.type = type;
        this.createTime = createTime;
        this.status = status;
        this.submission = submission;
    }


    // 实现了Comparable接口，用于按照一维projectId,二维taskId,三维type排序
    public int compareTo(SubTaskForLab o) {
        if (this.projectId != o.projectId) {
            return this.projectId - o.projectId;
        } else if (this.taskId != o.taskId) {
            return this.taskId - o.taskId;
        } else {
            return this.type - o.type;
        }
    }

}
